package ca.seia.comp6521.a1.io;

import static org.junit.Assert.*;

import java.io.File;
import java.util.Arrays;

import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

public class DataFileWriterTestCase {

	
	
//	@Rule
//	public TemporaryFolder tempFolder = new TemporaryFolder();
//	
//	@Before
//	public void setUp() throws Exception {
//	}
//
//	@After
//	public void tearDown() throws Exception {
//	}
//
//	@Test
//	public void testWritingToFile() throws Exception {
//		int[] numbers = {1,2,3,4,5};
//		File file = tempFolder.newFile();
//		
//		DataFileWriter dataFileWriter = new DataFileWriter(file.getAbsolutePath());
//		dataFileWriter.writeNextIntegers(numbers);
//		assertTrue("file length must be greater than 0 " + file.length(), file.length() > 0);
//	}
//	
//	@Test
//	public void testContentsOfFile() throws Exception {
//		int[] numbers = {1,2,3,4,5};
//		File file = tempFolder.newFile();
//		
//		DataFileWriter dataFileWriter = new DataFileWriter(file.getAbsolutePath());
//		dataFileWriter.writeNextIntegers(numbers);
//		
//		DataFileReader dataFileReader = new DataFileReader(file.getAbsolutePath());
//		Boolean dummy = null;
//		int[] writtenValues = dataFileReader.readNextIntegers(5,  dummy);
//		
//		assertArrayEquals(numbers, writtenValues);
//	}
//	
//	@Test
//	public void testAppendingContentsToFile() throws Exception {
//		int[] numbers = {1,2,3,4,5};
//		int[] expectedWrittenValues = {1,2,3,4,5,1,2,3,4,5};
//		File file = tempFolder.newFile();
//		
//		DataFileWriter dataFileWriter = new DataFileWriter(file.getAbsolutePath());
//		dataFileWriter.writeNextIntegers(numbers);
//		dataFileWriter.writeNextIntegers(numbers);
//		
//		DataFileReader dataFileReader = new DataFileReader(file.getAbsolutePath());
//		Boolean dummy = null;
//		int[] actualWrittenValues = dataFileReader.readNextIntegers(10,  dummy);
//		
//		assertArrayEquals(expectedWrittenValues, actualWrittenValues);
//	}
//	
//	@Test
//	public void testResetAppendModToCreateNewContentInFile() throws Exception {
//		int[] numbers = {1,2,3,4,5};
//		int[] expectedWrittenValues = {1};
//		File file = tempFolder.newFile();
//		
//		DataFileWriter dataFileWriter = new DataFileWriter(file.getAbsolutePath());
//		dataFileWriter.writeNextIntegers(numbers);
//		dataFileWriter.setCreationMode();
//		dataFileWriter.writeNextIntegers(expectedWrittenValues);
//		
//		DataFileReader dataFileReader = new DataFileReader(file.getAbsolutePath());
//		Boolean dummy = null;
//		int[] actualWrittenValues = dataFileReader.readNextIntegers(expectedWrittenValues.length,  dummy);
//		assertArrayEquals(expectedWrittenValues, actualWrittenValues);
//	}
//	
//	
	
}
